home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c++ / 1101 < prev    next >
Encoding:
Text File  |  1996-08-06  |  1.3 KB  |  43 lines

  1. Path: engnews1.Eng.Sun.COM!taumet!clamage
  2. From: freyburg@glitch.stanford.edu (Brian Michael Freyburger)
  3. Newsgroups: comp.std.c++
  4. Subject: Template argument deduction
  5. Date: 15 Apr 1996 21:47:00 GMT
  6. Organization: Stanford University
  7. Approved: clamage@eng.sun.com (comp.std.c++)
  8. Message-ID: <FREYBURG.96Apr15144107@glitch.stanford.edu>
  9. NNTP-Posting-Host: taumet.eng.sun.com
  10. X-Nntp-Posting-Host: glitch.stanford.edu
  11. Content-Length: 443
  12. X-Lines: 21
  13. Originator: clamage@taumet
  14.  
  15.  
  16. Reading section 14.10.2 of the January WP, I can not figure out
  17. whether the following function call can be deduced:
  18.  
  19. template <class S, class T = S>
  20. int foo(S s, T t = T());
  21.  
  22. int bar()
  23. {
  24.   foo(1);
  25. }
  26.  
  27. The compiler must deduce that S is int from the one argument
  28. specified, then determine that T is int from the default parameter for
  29. T, and finally determine that the second argument has the default
  30. value of int().
  31.  
  32.  
  33. Thanks,
  34.  
  35. Brian Freyburger
  36.  
  37.  
  38. [ comp.std.c++ is moderated.  To submit articles: try just posting with      ]
  39. [ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu         ]
  40. [ FAQ:      http://reality.sgi.com/employees/austern_mti/std-c++/faq.html    ]
  41. [ Policy:   http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
  42. [ Comments? mailto:std-c++-request@ncar.ucar.edu                             ]
  43.